package lesson04;

import java.net.MalformedURLException;
import java.net.URL;

public class DRLDemo01 {
    public static void main(String[] args) throws MalformedURLException {
        URL url = new URL("http://localhost:8080/helloworld/index.jsp?username=kuangshen&password==123");

        //协议http
        System.out.println(url.getProtocol());
        //主机ip,localhost
        System.out.println(url.getHost());
        //端口，8080
        System.out.println(url.getPort());
        //文件，/helloworld/index.jsp
        System.out.println(url.getPath());
        //全路径，/helloworld/index.jsp?username=kuangshen&password==123
        System.out.println(url.getFile());
        //参数，username=kuangshen&password==123
        System.out.println(url.getQuery());
    }
}
